package main

import (
	"flag"
	"fmt"
	"undertow_accesslog_analyse/analyse"
	"undertow_accesslog_analyse/cmd"
	"undertow_accesslog_analyse/config"
	"undertow_accesslog_analyse/filesearch"
)

// 配置文件目录
var confFile string

func main() {
	flag.StringVar(&confFile, "f", "config/config.yaml", "配置文件")
	flag.Parse()
	conf := config.Setup(confFile)
	fileNames := filesearch.Search(conf.Dir, conf.FileReg, conf.Recursion)
	fmt.Println(fileNames)
	analyseResult := analyse.Analyse(fileNames, conf.LogFormat)
	cmd.Setup(analyseResult)
}
